# Maintainer: Alexey Pavlov <alexpux@gmail.com>
# Maintainer: Ray Donnelly <mingw.android@gmail.com>
# Contributor: Saul Ibarra Corretge <saghul@gmail.com>
# Contributor: Frode Solheim <frode@fs-uae.net>

_primary_python="no"
_pybasever=3.10
_realname=python

if [[ "${_primary_python}" == "yes" ]]; then
  pkgbase="mingw-w64-${_realname}"
  pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
  provides=("${MINGW_PACKAGE_PREFIX}-python3"
            "${MINGW_PACKAGE_PREFIX}-python${_pybasever}")
  conflicts=("${MINGW_PACKAGE_PREFIX}-python3"
             "${MINGW_PACKAGE_PREFIX}-python${_pybasever}"
            "${MINGW_PACKAGE_PREFIX}-python2<2.7.16-7")
  replaces=("${MINGW_PACKAGE_PREFIX}-python3"
            "${MINGW_PACKAGE_PREFIX}-python${_pybasever}")
else
  pkgbase="mingw-w64-${_realname}${_pybasever}"
  pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}${_pybasever}")
fi
pkgver=${_pybasever}.0
pkgrel=2
pkgdesc="A high-level scripting language (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
license=('PSF')
url="https://www.python.org/"
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs"
         "${MINGW_PACKAGE_PREFIX}-expat"
         "${MINGW_PACKAGE_PREFIX}-bzip2"
         "${MINGW_PACKAGE_PREFIX}-libffi"
         "${MINGW_PACKAGE_PREFIX}-mpdecimal"
         "${MINGW_PACKAGE_PREFIX}-ncurses"
         "${MINGW_PACKAGE_PREFIX}-openssl"
         "${MINGW_PACKAGE_PREFIX}-sqlite3"
         "${MINGW_PACKAGE_PREFIX}-tcl"
         "${MINGW_PACKAGE_PREFIX}-tk"
         "${MINGW_PACKAGE_PREFIX}-zlib"
         "${MINGW_PACKAGE_PREFIX}-xz"
         "${MINGW_PACKAGE_PREFIX}-tzdata")
makedepends=(
  "${MINGW_PACKAGE_PREFIX}-cc"
  "${MINGW_PACKAGE_PREFIX}-autotools"
  "autoconf-archive"
)
options=('makeflags') # 'debug' '!strip')
source=("https://www.python.org/ftp/python/${pkgver%rc?}/Python-${pkgver}.tar.xz"
        0001-sysconfig-make-_sysconfigdata.py-relocatable.patch
        0002-restore-setup-config.patch
        0003-build-add-with-nt-threads-and-make-it-default-on-min.patch
        0004-MINGW-translate-gcc-internal-defines-to-python-platf.patch
        0005-MINGW-configure-MACHDEP-and-platform-for-build.patch
        0006-MINGW-preset-configure-defaults.patch
        0007-MINGW-configure-largefile-support-for-windows-builds.patch
        0008-MINGW-add-srcdir-PC-to-CPPFLAGS.patch
        0009-MINGW-init-system-calls.patch
        0010-MINGW-build-in-windows-modules-winreg.patch
        0011-MINGW-determine-if-pwdmodule-should-be-used.patch
        0012-issue6672-v2-Add-Mingw-recognition-to-pyport.h-to-al.patch
        0013-MINGW-configure-for-shared-build.patch
        0014-MINGW-dynamic-loading-support.patch
        0015-MINGW-ignore-main-program-for-frozen-scripts.patch
        0016-MINGW-setup-_multiprocessing-module.patch
        0017-MINGW-setup-select-module.patch
        0018-MINGW-setup-_ctypes-module-with-system-libffi.patch
        0019-MINGW-defect-winsock2-and-setup-_socket-module.patch
        0020-MINGW-exclude-unix-only-modules.patch
        0021-MINGW-setup-msvcrt-and-_winapi-modules.patch
        0022-sysconfig-MINGW-build-extensions-with-GCC.patch
        0023-MINGW-setup-_ssl-module.patch
        0024-MINGW-generalization-of-posix-build-in-sysconfig.py.patch
        0025-MINGW-support-stdcall-without-underscore.patch
        0026-use-replace-instead-rename-to-avoid-failure-on-windo.patch
        0027-MINGW-customize-site.patch
        0028-add-python-config-sh.patch
        0029-cross-darwin-feature.patch
        0030-mingw-system-libffi.patch
        0031-msys-mingw-prefer-unix-sep-if-MSYSTEM.patch
        0032-mingw-use-posix-getpath.patch
        0033-mingw-add-ModuleFileName-dir-to-PATH.patch
        0034-mingw-add-BUILDIN_WIN32_MODULEs-time-msvcrt.patch
        0035-msys-cygwin-semi-native-build-sysconfig.patch
        0036-sysconfig-mingw-sysconfig-like-posix.patch
        0037-build-_winapi-earlier-so-we-can-use-it-in-distutils-.patch
        0038-cross-dont-add-multiarch-paths-if-cross-compiling.patch
        0039-mingw-use-backslashes-in-compileall-py.patch
        0040-msys-convert_path-fix-and-root-hack.patch
        0041-allow-static-tcltk.patch
        0042-mingw-pdcurses_ISPAD.patch
        0043-builddir-fixes.patch
        0044-msys-monkeypatch-os-system-via-sh-exe.patch
        0045-msys-replace-slashes-used-in-io-redirection.patch
        0046-remove_path_max.default.patch
        0047-dont-link-with-gettext.patch
        0048-ctypes-python-dll.patch
        0049-gdbm-module-includes.patch
        0050-use-gnu_printf-in-format.patch
        0051-mingw-fix-ssl-dont-use-enum_certificates.patch
        0052-fix-using-dllhandle-and-winver-mingw.patch
        0053-Add-AMD64-to-sys-config-so-msvccompiler-get_build_ve.patch
        0054-MINGW-link-with-additional-library.patch
        0055-install-msilib.patch
        0056-fix-signal-module-build.patch
        0057-build-build-winconsoleio-and-_testconsole.patch
        0058-expose-sem_unlink.patch
        0059-cygpty-isatty.patch
        0060-disable-broken-gdbm-module.patch
        0061-build-link-win-resource-files-and-build-pythonw.patch
        0062-disable-readline.patch
        0063-fix-isselectable.patch
        0064-use-_wcsnicmp-instead-wcsncasecmp.patch
        0065-_xxsubinterpretersmodule.patch
        0066-sqlite3-module-defines.patch
        0067-configure.ac-fix-inet_pton-check.patch
        0068-set-venv-activate-path-unix.patch
        0069-venv-creation-fixes.patch
        0070-pass-gen-profile-ldflags.patch
        0071-pkg-config-windows-must-link-ext-with-python-lib.patch
        0072-importlib-bootstrap-path-sep.patch
        0073-pathlib-path-sep.patch
        0074-warnings-fixes.patch
        0075-fix-build-testinternalcapi.patch
        0076-extend-MS_WINDOWS-flag.patch
        0077-clang-arm64.patch
        0078-configure.ac-set-MINGW-stack-reserve.patch
        0079-Don-t-use-os.pathsep-to-find-EOF.patch
        0080-Fix-extension-suffix-for-c-extensions-on-mingw.patch
        0081-Change-the-get_platform-method-in-sysconfig.patch
        0082-distutils-compiler-customize-mingw-cygwin-compilers.patch
        0083-distutils-compiler-enable-new-dtags.patch
        0084-distutils-MINGW-build-extensions-with-GCC.patch
        0085-distutils-use-Mingw32CCompiler-as-default-compiler-f.patch
        0086-distutils-find-import-library.patch
        0087-distutils-avoid-circular-dependency-from-time-module.patch
        0088-distutils-generalization-of-posix-build-in-distutils.patch
        0089-distutils-mingw-sysconfig-like-posix.patch
        0090-distutils-get_versions-fixes.patch
        0091-distutils-install-layout-as-posix.patch
        0092-distutils-msys-convert_path-fix-and-root-hack.patch
        0093-distutils-mingw-build-optimized-ext.patch
        0094-distutils-cygwinccompiler-dont-strip-modules-if-pyde.patch
        0095-distutils-get-compilers-from-env-vars.patch
        0096-distutils-add-windmc-to-cygwinccompiler.patch
        0097-distutils-fix-msvc9-import.patch
        0098-distutils-mingw-add-LIBPL-to-library-dirs.patch
        0099-distutils-Change-the-get_platform-method-in-distutil.patch
        0100-build-Fix-ncursesw-include-lookup.patch
        0101-tests-fix-test_bytes.patch
        0102-time-fix-strftime-not-raising-for-invalid-year-value.patch
        0103-ctypes-find_library-c-should-return-None-with-ucrt.patch
        0104-build-Disable-checks-for-dlopen-dlfcn.patch
        0105-Fix-install-location-of-the-import-library.patch
        0106-Set-MSYS2_ARG_CONV_EXCL-for-the-shared-Python-module.patch
        0107-build-Integrate-venvlauncher-build-installation-into.patch
        0108-configure.ac-set-_WIN32_WINNT-version.patch
        0109-configure.ac-don-t-check-for-clock_-functions.patch
        0110-expanduser-normpath-paths-coming-from-env-vars.patch
        0111-Add-support-for-Windows-7-Python-3.9.patch
        0112-CI-test-the-build-and-add-some-mingw-specific-tests.patch
        0113-smoketests-test-that-_decimal-exists.patch
        0114-Prefer-sysconfig.python_build.patch
        0115-Define-PY3_DLLNAME-to-fix-build.patch
        0116-Commit-regenerated-importlib.patch
        0117-distutils-remove-checks-for-ancient-gcc-binutils.patch
        0118-distutils-split-CC-env-var-before-passing-to-subproc.patch
        0119-_testconsole.c-Fix-casing-path-sep.patch
        0120-Return-consistent-architecture-markers-for-python-on.patch
        0121-distutils-add-back-gcc_version.patch
        0122-fix-mingw-cross-compiling-in-setup.py.patch
        0123-Use-actions-setup-python-for-setting-up-correct-vers.patch
        0124-Fix-buffer-overflow-in-Py_GetSepW.patch
        0125-Remove-unnecessary-strlen-in-Py_NormalizeSepsW.patch
        0126-handle-ncursesw-pkg-config-when-cross-compiling.patch
        0127-CI-add-cross-llvm-mingw-jobs.patch
        0128-fixup-Define-PY3_DLLNAME-to-fix-build.patch
        0129-Skip-building-c-extensions-if-python-is-running-in-b.patch
        0130-mingw_smoketests-fix-_UCRT-condition.patch
        0131-CI-fix-sed-pattern-for-python-config.py-shebang.patch
        0132-Modify-sys.winver-to-match-upstream.patch
        0133-Change-user-site-packages-path-to-include-the-enviro.patch
        0134-fixup-CI-test-the-build-and-add-some-mingw-specific-.patch)

# Helper macros to help make tasks easier #
apply_patch_with_msg() {
  for _patch in "$@"
  do
    msg2 "Applying ${_patch}"
    patch -Nbp1 -i "${srcdir}/${_patch}"
  done
}

prepare() {
  cd "${srcdir}/Python-${pkgver}"

 apply_patch_with_msg 0001-sysconfig-make-_sysconfigdata.py-relocatable.patch \
  0002-restore-setup-config.patch \
  0003-build-add-with-nt-threads-and-make-it-default-on-min.patch \
  0004-MINGW-translate-gcc-internal-defines-to-python-platf.patch \
  0005-MINGW-configure-MACHDEP-and-platform-for-build.patch \
  0006-MINGW-preset-configure-defaults.patch \
  0007-MINGW-configure-largefile-support-for-windows-builds.patch \
  0008-MINGW-add-srcdir-PC-to-CPPFLAGS.patch \
  0009-MINGW-init-system-calls.patch \
  0010-MINGW-build-in-windows-modules-winreg.patch \
  0011-MINGW-determine-if-pwdmodule-should-be-used.patch \
  0012-issue6672-v2-Add-Mingw-recognition-to-pyport.h-to-al.patch \
  0013-MINGW-configure-for-shared-build.patch \
  0014-MINGW-dynamic-loading-support.patch \
  0015-MINGW-ignore-main-program-for-frozen-scripts.patch \
  0016-MINGW-setup-_multiprocessing-module.patch \
  0017-MINGW-setup-select-module.patch \
  0018-MINGW-setup-_ctypes-module-with-system-libffi.patch \
  0019-MINGW-defect-winsock2-and-setup-_socket-module.patch \
  0020-MINGW-exclude-unix-only-modules.patch \
  0021-MINGW-setup-msvcrt-and-_winapi-modules.patch \
  0022-sysconfig-MINGW-build-extensions-with-GCC.patch \
  0023-MINGW-setup-_ssl-module.patch \
  0024-MINGW-generalization-of-posix-build-in-sysconfig.py.patch \
  0025-MINGW-support-stdcall-without-underscore.patch \
  0026-use-replace-instead-rename-to-avoid-failure-on-windo.patch \
  0027-MINGW-customize-site.patch \
  0028-add-python-config-sh.patch \
  0029-cross-darwin-feature.patch \
  0030-mingw-system-libffi.patch \
  0031-msys-mingw-prefer-unix-sep-if-MSYSTEM.patch \
  0032-mingw-use-posix-getpath.patch \
  0033-mingw-add-ModuleFileName-dir-to-PATH.patch \
  0034-mingw-add-BUILDIN_WIN32_MODULEs-time-msvcrt.patch \
  0035-msys-cygwin-semi-native-build-sysconfig.patch \
  0036-sysconfig-mingw-sysconfig-like-posix.patch \
  0037-build-_winapi-earlier-so-we-can-use-it-in-distutils-.patch \
  0038-cross-dont-add-multiarch-paths-if-cross-compiling.patch \
  0039-mingw-use-backslashes-in-compileall-py.patch \
  0040-msys-convert_path-fix-and-root-hack.patch \
  0041-allow-static-tcltk.patch \
  0042-mingw-pdcurses_ISPAD.patch \
  0043-builddir-fixes.patch \
  0044-msys-monkeypatch-os-system-via-sh-exe.patch \
  0045-msys-replace-slashes-used-in-io-redirection.patch \
  0046-remove_path_max.default.patch \
  0047-dont-link-with-gettext.patch \
  0048-ctypes-python-dll.patch \
  0049-gdbm-module-includes.patch \
  0050-use-gnu_printf-in-format.patch \
  0051-mingw-fix-ssl-dont-use-enum_certificates.patch \
  0052-fix-using-dllhandle-and-winver-mingw.patch \
  0053-Add-AMD64-to-sys-config-so-msvccompiler-get_build_ve.patch \
  0054-MINGW-link-with-additional-library.patch \
  0055-install-msilib.patch \
  0056-fix-signal-module-build.patch \
  0057-build-build-winconsoleio-and-_testconsole.patch \
  0058-expose-sem_unlink.patch \
  0059-cygpty-isatty.patch \
  0060-disable-broken-gdbm-module.patch \
  0061-build-link-win-resource-files-and-build-pythonw.patch \
  0062-disable-readline.patch \
  0063-fix-isselectable.patch \
  0064-use-_wcsnicmp-instead-wcsncasecmp.patch \
  0065-_xxsubinterpretersmodule.patch \
  0066-sqlite3-module-defines.patch \
  0067-configure.ac-fix-inet_pton-check.patch \
  0068-set-venv-activate-path-unix.patch \
  0069-venv-creation-fixes.patch \
  0070-pass-gen-profile-ldflags.patch \
  0071-pkg-config-windows-must-link-ext-with-python-lib.patch \
  0072-importlib-bootstrap-path-sep.patch \
  0073-pathlib-path-sep.patch \
  0074-warnings-fixes.patch \
  0075-fix-build-testinternalcapi.patch \
  0076-extend-MS_WINDOWS-flag.patch \
  0077-clang-arm64.patch \
  0078-configure.ac-set-MINGW-stack-reserve.patch \
  0079-Don-t-use-os.pathsep-to-find-EOF.patch \
  0080-Fix-extension-suffix-for-c-extensions-on-mingw.patch \
  0081-Change-the-get_platform-method-in-sysconfig.patch \
  0082-distutils-compiler-customize-mingw-cygwin-compilers.patch \
  0083-distutils-compiler-enable-new-dtags.patch \
  0084-distutils-MINGW-build-extensions-with-GCC.patch \
  0085-distutils-use-Mingw32CCompiler-as-default-compiler-f.patch \
  0086-distutils-find-import-library.patch \
  0087-distutils-avoid-circular-dependency-from-time-module.patch \
  0088-distutils-generalization-of-posix-build-in-distutils.patch \
  0089-distutils-mingw-sysconfig-like-posix.patch \
  0090-distutils-get_versions-fixes.patch \
  0091-distutils-install-layout-as-posix.patch \
  0092-distutils-msys-convert_path-fix-and-root-hack.patch \
  0093-distutils-mingw-build-optimized-ext.patch \
  0094-distutils-cygwinccompiler-dont-strip-modules-if-pyde.patch \
  0095-distutils-get-compilers-from-env-vars.patch \
  0096-distutils-add-windmc-to-cygwinccompiler.patch \
  0097-distutils-fix-msvc9-import.patch \
  0098-distutils-mingw-add-LIBPL-to-library-dirs.patch \
  0099-distutils-Change-the-get_platform-method-in-distutil.patch \
  0100-build-Fix-ncursesw-include-lookup.patch \
  0101-tests-fix-test_bytes.patch \
  0102-time-fix-strftime-not-raising-for-invalid-year-value.patch \
  0103-ctypes-find_library-c-should-return-None-with-ucrt.patch \
  0104-build-Disable-checks-for-dlopen-dlfcn.patch \
  0105-Fix-install-location-of-the-import-library.patch \
  0106-Set-MSYS2_ARG_CONV_EXCL-for-the-shared-Python-module.patch \
  0107-build-Integrate-venvlauncher-build-installation-into.patch \
  0108-configure.ac-set-_WIN32_WINNT-version.patch \
  0109-configure.ac-don-t-check-for-clock_-functions.patch \
  0110-expanduser-normpath-paths-coming-from-env-vars.patch \
  0111-Add-support-for-Windows-7-Python-3.9.patch \
  0112-CI-test-the-build-and-add-some-mingw-specific-tests.patch \
  0113-smoketests-test-that-_decimal-exists.patch \
  0114-Prefer-sysconfig.python_build.patch \
  0115-Define-PY3_DLLNAME-to-fix-build.patch \
  0116-Commit-regenerated-importlib.patch \
  0117-distutils-remove-checks-for-ancient-gcc-binutils.patch \
  0118-distutils-split-CC-env-var-before-passing-to-subproc.patch \
  0119-_testconsole.c-Fix-casing-path-sep.patch \
  0120-Return-consistent-architecture-markers-for-python-on.patch \
  0121-distutils-add-back-gcc_version.patch \
  0122-fix-mingw-cross-compiling-in-setup.py.patch \
  0123-Use-actions-setup-python-for-setting-up-correct-vers.patch \
  0124-Fix-buffer-overflow-in-Py_GetSepW.patch \
  0125-Remove-unnecessary-strlen-in-Py_NormalizeSepsW.patch \
  0126-handle-ncursesw-pkg-config-when-cross-compiling.patch \
  0127-CI-add-cross-llvm-mingw-jobs.patch \
  0128-fixup-Define-PY3_DLLNAME-to-fix-build.patch \
  0129-Skip-building-c-extensions-if-python-is-running-in-b.patch \
  0130-mingw_smoketests-fix-_UCRT-condition.patch \
  0131-CI-fix-sed-pattern-for-python-config.py-shebang.patch \
  0132-Modify-sys.winver-to-match-upstream.patch \
  0133-Change-user-site-packages-path-to-include-the-enviro.patch \
  0134-fixup-CI-test-the-build-and-add-some-mingw-specific-.patch
 
  autoreconf -vfi
}

build() {
  declare -a _extra_config
  if check_option "debug" "n"; then
    _extra_config+=("--enable-optimizations")
    # FIXME: https://github.com/msys2-contrib/cpython-mingw/issues/10
    # _extra_config+=("--with-lto")
  else
    CFLAGS+=" -O0 -ggdb"
    CXXFLAGS+=" -O0 -ggdb"
    _extra_config+=("--with-pydebug")
  fi

  [[ -d "${srcdir}/build-${CARCH}" ]] && rm -rf "${srcdir}/build-${CARCH}"
  mkdir -p "${srcdir}/build-${CARCH}" && cd "${srcdir}/build-${CARCH}"

  ../Python-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --host=${MINGW_CHOST} \
    --build=${MINGW_CHOST} \
    --enable-shared \
    --with-system-expat \
    --with-system-ffi \
    --with-system-libmpdec \
    --without-ensurepip \
    --without-c-locale-coercion \
    --enable-loadable-sqlite-extensions \
    --with-tzpath=${MINGW_PREFIX}/share/zoneinfo \
    "${_extra_config[@]}"

  make
}

check() {
  cd "${srcdir}/build-${CARCH}"

  # Some basic tests to ensure nothing major or MSYS2 specific features are broken
  ./python.exe "../Python-${pkgver}/mingw_smoketests.py"
  MSYSTEM= ./python.exe "../Python-${pkgver}/mingw_smoketests.py"
}

package() {
  cd "${srcdir}/build-${CARCH}"

  make -j1 install DESTDIR="${pkgdir}"

  # gdb pretty printers for debugging Python itself; to use:
  # python
  # sys.path.append('C:/msys64/mingw64/share/gdb/python3')
  # import python_gdb
  # reload(python_gdb)
  # end
  if [[ "${_primary_python}" == "yes" ]]; then
    [[ -d "${pkgdir}${MINGW_PREFIX}"/share/gdb/python3/ ]] || mkdir -p "${pkgdir}${MINGW_PREFIX}"/share/gdb/python3/
    cp -f python.exe-gdb.py "${pkgdir}${MINGW_PREFIX}"/share/gdb/python3/python_gdb.py
  fi

  # some useful "stuff"
  install -dm755 "${pkgdir}${MINGW_PREFIX}"/lib/python${_pybasever}/Tools/{i18n,scripts}
  install -m755 "${srcdir}/Python-${pkgver}"/Tools/i18n/{msgfmt,pygettext}.py "${pkgdir}${MINGW_PREFIX}"/lib/python${_pybasever}/Tools/i18n/
  install -m755 "${srcdir}/Python-${pkgver}"/Tools/scripts/{README,*py} "${pkgdir}${MINGW_PREFIX}"/lib/python${_pybasever}/Tools/scripts/

  # fixup shebangs
  for fscripts in 2to3 2to3-${_pybasever} idle3 idle${_pybasever} pydoc3 pydoc${_pybasever}; do
    sed -i "s|$(cygpath -w ${MINGW_PREFIX} | sed 's|\\|\\\\|g')/bin/python${_pybasever}.exe|/usr/bin/env python${_pybasever}.exe|g" \
      "${pkgdir}${MINGW_PREFIX}"/bin/${fscripts}
  done

  # default aliases for all scripts/binaries
  if [[ "${_primary_python}" == "yes" ]]; then
    # Default names are aliases for Python now
    cp "${pkgdir}${MINGW_PREFIX}"/bin/python3.exe "${pkgdir}${MINGW_PREFIX}"/bin/python.exe
    cp "${pkgdir}${MINGW_PREFIX}"/bin/python3w.exe "${pkgdir}${MINGW_PREFIX}"/bin/pythonw.exe
    cp "${pkgdir}${MINGW_PREFIX}"/bin/python3-config "${pkgdir}${MINGW_PREFIX}"/bin/python-config
    cp "${pkgdir}${MINGW_PREFIX}"/bin/idle3 "${pkgdir}${MINGW_PREFIX}"/bin/idle
    cp "${pkgdir}${MINGW_PREFIX}"/bin/pydoc3 "${pkgdir}${MINGW_PREFIX}"/bin/pydoc
  fi

  # delete anything that could conflict with the primary Python
  if [[ "${_primary_python}" != "yes" ]]; then
    rm "${pkgdir}${MINGW_PREFIX}"/bin/python3.exe
    rm "${pkgdir}${MINGW_PREFIX}"/bin/python3w.exe
    rm "${pkgdir}${MINGW_PREFIX}"/bin/python3-config
    rm "${pkgdir}${MINGW_PREFIX}"/bin/idle3
    rm "${pkgdir}${MINGW_PREFIX}"/bin/pydoc3
    rm "${pkgdir}${MINGW_PREFIX}"/bin/2to3
    rm "${pkgdir}${MINGW_PREFIX}"/lib/pkgconfig/python3-embed.pc
    rm "${pkgdir}${MINGW_PREFIX}"/lib/pkgconfig/python3.pc
    rm "${pkgdir}${MINGW_PREFIX}"/share/man/man1/python3.1
  fi
}

sha256sums=('5a99f8e7a6a11a7b98b4e75e0d1303d3832cada5534068f69c7b6222a7b1b002'
            '49618c0b5af0319f64bd8da3116f77d9726a77276cffacebc4d3de645c327bb7'
            'd967c60781f6a4ef3464799ca398469d03249f9673c8ce769a3e2da33eb33193'
            'b70136017f533468b64ba1b289498f6ddda88715b48016c7804b2186af6884cc'
            '8dcb76c1858de03f903085602fd7271dc3baefa058eaa1b8f186a11bf80a01e6'
            'f13a51e2efc5d539eadf8dfa71bdcd6cd1e93ecf71da96f217bc385718fdb11f'
            '0097f4d3d20ed9690cbbdcde5a24cd4551117082b18fe309f34bbc5672bc0223'
            '8d3a42cbf36eef51167308824f9a6c60b6ea78453a9f50edd7f69d2975da6ab9'
            '9557ef72cb9ee75d8118794d980926a3240bda42dea08b8f5259d61e17d5ae53'
            'd16d82e6b18fc1dc587469b7131730f282888ba05c1195f6a4b8c8658c74c0bb'
            'bb99cc9af5bfa8bbf3324b7716718bf5d4a5a7359817b97b86eefc5f042daa20'
            '6948926186af5e415268dc95c9a5641c5f11633bf5da3b4fcadfa6d27d695be0'
            '230e40e7bc78dbd0fa69677d836015b7e53f380cfbfc5e12c536996ed54d76c4'
            '40e656ec45c2e8a4c877d52f28b97b114fff6504ca439d04c6a9001407f07c34'
            '9630401fb31c9dc53ea5c6ecbb22eba40a1fdbb18a13489054abe573a4a4dd50'
            'b258a25430b3f8787395ec726ca329da8181dbbc5e6fbae38a5fdf9d990f91e8'
            'cd15083767565d34c936df5ae71d701a57abcc6b454c68234862afe7c69207dc'
            '956264e6b45cb12f5c3ee80acea9d1da54a3f3210cb19219867138f9d7b310b2'
            '429c46ed0e0fd0aba50b3cb137afcef04a2ce70b4d0ec0b2e64f75c4942053a2'
            '6e90416d1283102b9160fb92c82f217c6de0586ddfbeea772d99971909ad2137'
            '5ea6e2c7cedc9cd27b611c5fb4554ccf653064d6c70408f528b4c33639631a40'
            '1f3c165c70be5dc174c04bb84e9181d1146847010dc0e2609a07bf96e4dd1378'
            '6f90192098bca07a1ae0363019302176ecc3c9749d00c4a4ad54d832c245b7f3'
            '07cfbe323e4afd72014886e74f07912aed8232445ff1edba42fd33d62121f5fb'
            'e7d0d99e2e6e99cc84642ad43ae4f473c14213f625f52f19615d2ea7d838fd5c'
            'b12e35c1e5c0a3af2cd53a7577c82618f15504f448215bb0513945ce4e7ce632'
            '01dffb1e99975e8259cc2446c4f7bfe2840c7d4813fd1766023b088a288d0fb0'
            '55abac4b324844ceb1c663887d70d25db7b06206a5a24e314db752e7082a3084'
            'e340fd684fc1c438d17173603a3b3675ef97dc6e5fcd343100ccc13834ce9daf'
            'ea5c7cd51c9b0bde9c8e78a7dda4af2637f7a540a03100ce1f7bc593676efdd4'
            '8c67c55bc6bfa8a7d27ca116ae5845a8b32bca67e161125ddbb6e6e4009d5fa9'
            '7b4a08cad5bd9436e750ad42219c20b018b8f514cf8b06ab6777533fc9895c06'
            '295e17e70dc9265985aeedaba1486867f7a4d8ae11cb5369bab93a086c47d3a1'
            '775d6fb87e1d84ca5869b3a47b3293c5206e0e4a51de8e7d9eb2da1246433450'
            '12fd50049ff6269ab5ac3d538e5bf4ed81876bdd95246bb481f2df9281dfd811'
            'c2e5c37523dbb3ce854d3a580a85a38db8281ae23b996b711447dc2836cf045d'
            '9eaf55be42c62b88037805cd5471b61142b473bbda07f86b9179deb0ce4cfa73'
            'b5cadc98a559d6378c8cf0608f8ea422d19e425ae1a6ff5d277623a6444f9834'
            'd724bca285f9e294c0d24d85551da081a91ead537fa468013af3418dd734bd73'
            '0be34c24ef9c4a9ed4698119a809a052330d4b354c56894cadd7d46e5f466fc4'
            '63f42fc9fb04849fd1f935a93ae69680d14c58d60aec42ec28392dd253f35948'
            '332ceca3d3b66f6e0bc9c291969bbf9e79acf3a5a8999130a70a832b209987ed'
            '4dd775bc9ce55776ccfa4c3179cdff7478ddc16eb0ca918ad3e886325833c7a0'
            '0def91845ccc127e4e31112563281f55c1e7b3ff6e07d04aaf6e0c472da98b20'
            'df176b3d2bf607a4daaea0f71146758c5b9c788cfd4f89fab8ddbd931b13c027'
            'b6c31a37e337db1a18e6014f7b33e93090006f00514b9af51287db997d064c09'
            'ad513d2c4389ffa4387fee56b68dfe4ff28cbaca218a0e53ea95b56fd8e0e795'
            '06201eb685d3e30f16c16d188162768bb8de575d3bc62f3c6e009de3d9e90da9'
            '57e20da131a77067c57619773ade31399afd98941d4f16bcd1c0d7eb7c5dbf9a'
            '07d4ee7fba51fae5a12c75381e5f833066e36322e37ccf25ab939aac16a6fe1e'
            'e0f5f889a477c2617e90f71714ad7c664814269ffdad5b8d298817a217ed76b7'
            '83f4306155cd15753728cb216963a003902399ac9a2b8ff78b5c1d3b8f2c6082'
            'de0eec9cb3301204288e9d32164a671ca5f70f4827dc5cceabb28daf6e8ada97'
            '6f33ef821cefe12ae37e236563ff92e460f34d28254acfbd9de2876b5b66a70d'
            '626d83642211ff3bcf3670acb93c64e61046ad57c56c92fd1fbbfffe9f30040a'
            'cfc5199d4c6d81c7b580b13ead08237c2b2abe754cf5473143c1b7f7a3e3a158'
            '79d740a0f2e0672d0b6a02e3bc76170c72950528822a12e928e9aa86d870196c'
            'd357d5cd5e81a0e4f0160a5f0b9883b59b71770d60775bb21c51c12332476e8e'
            '801014ec41210b4b70d296bf253fd277455c0d94e2f26698bef8eddebb88d31d'
            '44a626b4aa3044c03d9defc093de1af27bad0ca3c9b07ed6d46d168f36bc2e0e'
            '7749de8e71a9d1cd47ee4c6cd70251588ffe7131b88c70992bffccfd6639879f'
            '69af2f044d0c352f900a35f73f5302dc5cc877c11a30141879620ae1d5ea4da7'
            'ab6fea6a12633cdb993b952d1a65db0eaa86639bb9be964b2491c3a1842b78a7'
            '6412dc510aff2c67a5e524a7777494a3963dae670873a4ae5e762206e1b967bd'
            'b3d79a7edddf573eb36fe64a7c8f41fa4957197b7124b1a79faaa734a80a2754'
            'cff906a05084471667e4b11b75fe86ccb8814aaed9e03b5e6e9010a8ccb9ee99'
            '5cacea9fa4c4426c8d4ffce103382caf2ffe489aa5edbd8e52ba05ed8c685642'
            '466ba894a34a1c8336d4598644fefc4baec7140ee63412529bf1aec1a9d2ffe5'
            'd5bf09a5ae9d5857dafd358ebbc52c690504aa625d4326aa45d4abbfe45484d8'
            '91110e2fe2e3ee7f577057d06011e4edfd6e6872b0395d7c930095c3d6c85170'
            '268d789a509859d538a87101644078506e0e90e53af6f311fb0ae756db142c45'
            '7340f5378c7b07f3a18eef858608e15f5787dd23109944ef283d2ab7f3c313f1'
            'ae46fb357c1e3509fb8c1ea30d50e121c499a6b40e149b3ff9f146298b799479'
            '1d1d5ede4971e6bfbed2cb20239814960508acf1b0d2285e328e010909519d98'
            'ad70b8ad094d03a957e1f815a15103aeafcfabf2882f9c2542924b47b94c5643'
            '2299b160137a57569da3ab9d3d47a8f5bbbc2e1c126a9241efead9f5e50305a1'
            '58cb8d0d9cb604f48f92cfb5dfab3d0d222a02078a5d4b98366ebdd93548f7f1'
            'c4e7f6771285942207856c6a3defb7c2ce4e88f00b63567dc647ce21f7186175'
            '2fce40567852f896ebf2f318511ded9de1cd3b86ba23cec4f80a65c36c762cf6'
            '5dd5f8f66456a4c784d7a83a9ea382ce540483fa8124133104b77405df77e605'
            'a5729712ea89d4e0255b73060967be02f4fb680be3c859015aa5995726b4d05b'
            'ec2810ff284e18ba8a61725bf461f4216ed6e9bd9fcd1e9c5fecae60a918eb86'
            '48d8cd76a81173736045dcb5cc1c2dfc9f9d3c5bed99c091a40814ee2d668cd2'
            'af9940b19c83059fc0d074f9fcfa22ebe637e925b6fba87d6d97e85d30ab1761'
            'b70d8367b0474035a2b5b8dfbae902e66638cbd5570cdf156c113a3cf6c10dcf'
            'a7fde729503456e488f220ac294a5eedd7e91ffa2d88370001e1ba98b4ad9cb2'
            'eebc37108cc8dc1b1edcedaa5321b12c69a96ec332bc60b46482cfcfb0c476af'
            '061ff107c640c09f9aa378c80478d7272083467fef87fd3f6a231b5d6c2f2964'
            '671bf53426cdeedbce5706768815ad4d0c97552994968f4b2925896d3c4e92ff'
            '96428d13bf18cb16bfd1e36c99a11e60140552765f5747f65d52a27ba229dce4'
            'fda87ec475f2b715a2939465e059df74118ed61d416803af312af5b132009621'
            'f59a64acb934334cea0d8324c79bbc0e2e463bec566f02d1d939cd15df6fa8cd'
            '81fc66d796662cd135d7af8750121592795a4acabe6e0d48998470eff4b2c890'
            'e95169f748e887d3a51b236b27d9aaa20f973366a239bbadbc58ba76c99f22f5'
            'cef3504d5219ae56ad59f090f76afea8f54e3f32242900d41c1d4f44840d5913'
            '485b8d30ebebf2c6c6c751daaf2c274d7688c9002f4b6686419d5d10e9f96c8b'
            '19e03ed5fe384924ef4a46ea76c319e07ac0a4567584f2d2e5f4ec816d858ded'
            '6dd342124a42c4ba9e9d510875a2c27a13b49477aecc878814cbfffd9014c258'
            'ee64c8ae96a1ff66a1550d010332747b3730296eed368809c254f2d6d8000748'
            '6dbb39bb40cbcbc6d3b3b2aca5e44a8d06c66e5438b03373ac98a8fee2519bc7'
            '28ecf42c99b62aa5112dd94900b532de4eedea1ab64ecf7d344d7e3b0d6d017c'
            '9ea3502b64b971cecdd48694dfc97b1574422dbe8c947a70409706c4b92ca6ec'
            '0c080b0a7a85db977279236d0c89cde8efe6f905df2b375186f1846c5a951380'
            'ccf98b1cf67b11f58e477ab8a81d4e1face254770edbfbfb67827af335558b50'
            'feb200d05871a458fc274dccbc1b0baea31d5a906e5329c144bd55275079b0d1'
            'd04d26131f8a0b9abe454d62a44839613cd65a402511aa030b8e7a7c6c7e7b7e'
            '2913f809e275d25c9bf09563a1a4ca75202a6e51f1585a79abc52cbb874bf817'
            'e8cc31cb279be390f311556a5f526071471fdf3a00bc69aebf9be48154b71705'
            '0ed520ee73fbfa59ece779fb9066ec307e7c03e6a8ef7f1c84d04ce7b5ded183'
            '1324774652eeb2d845766864cd0815c3d265dbe100cdeaeef22a93e7b6ed5853'
            '9b85b9d266a722159841ad62fe68488f0475e9eb88b64afc258743845f6e322d'
            'c1bbe975b489e497c125a652704114476e83c5d1d1ed75c51f588573f94ffa97'
            'b43b2fdca79500064fff00529e692df62b4a1e9344c052c88689f5ca4e77004d'
            '47565e5857c73fe34c2b4f5ff924a07ce730dabeeb1fb3f02e8503360652be4d'
            '2552ec78fd9b8ffd9e6e298fffb904c651d9a97be2de021700205957e9d99b40'
            '903c4acdc79668da068b11b8462b639995b00af9763d3eaedcf4161ee3856f6c'
            '0df47db20b0ced0edc478f3bc310aa97d0508c51908548ec8d4e8a13e0868da2'
            '6089c20e220678b78c77846691fdde1a47fa564fa72c1a0798d5a47b6ba3ac1d'
            '6260210b104b496f789d2be8d6b91da97bcdd3ad3593282730bc64847ff6347c'
            '46aaf9522409d61e065e19f84ea11b4de2d12a0d6bc992568881ed2af1dafc20'
            'd38c3d668a19ebc7ea9c35cec4e3a7323f2d2dd2041f5ec779ae20d0cec390f4'
            '6f10f1d075d280c1144b5befab807369d293e3c0f40267801f820cf571ad9e20'
            '14bd4f030f4524aef2f4c59f515483430de2d635b81037f5a30200238a232c64'
            '1f523c358949daf9cdce4cafa93c785dde082fd3892c4bdf47b7a2a9b8bd8933'
            '7a7c2f1879671d894c597be96d185438317897b5281658a73a464ddb153cc0ea'
            '653df26a0662eeff7cde8aca1bb30caf911a66695dca92e9b5425f50d8058a8c'
            '4883bf83e1dd318d82a404b10188a38229a9b9ebddfc2274501d8e15ae0c9903'
            'd20ad39ad797b81593ca94de2620943d517ddb2d21566d8f689fe7a31e1b7df6'
            '8a53abcb152f4c991eb50ec529218fcc09203cd5f785e6f465978a6a39536bab'
            'a2097d570436a3bd887eeb52d294ffd4da1c6de2d35af0eedd067cf900ff6910'
            'cc33b9ddbc5d325274230a005d817eccd0a39c070a07b53616bcb2e2369d19df'
            '5183825bac10240c4beafbd1df20238157be20749a5829d8fea8784ae5964beb'
            '3f93aa4eab792fab655112c95d2ddd5b8f15fde31774fd2b948742b95827a24b'
            'c4b4cd406df030366bc534c7f35f45ab0d51e870d57c7f1d0490a55e5a11cfc6'
            '78112bcc410b135494c64ec158ea6207ca5b490c52bb1758c19b404e0b323035')
